#include <iostream>
#include <spdlog/spdlog.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/async.h>
int main()
{
    spdlog::flush_every(std::chrono::seconds(1));
    spdlog::flush_on(spdlog::level::level_enum::trace);
    spdlog::set_level(spdlog::level::level_enum::trace);
    //异步模式
    //配置线程池
    spdlog::init_thread_pool(3072, 1);
    //创建异步日志器（标准输出/文件） -- 工厂接口默认创建的就是同步日志器
    auto logger = spdlog::stdout_color_mt<spdlog::async_factory>("async-logger");
    std::string str = "hello word";
    logger->warn("你好！{} {}", "小明", str);
    logger->debug("你好！{}", "小明");
    logger->info("你好！{}", "小明");
    logger->warn("你好！{}", "小明");
    logger->error("你好！{}", "小明");
    logger->critical("你好！{}", "小明");
    std::cout << "日志输出演示完毕！\n";
    return 0;
}